<template>
  <div class="wrap">
    <teleport to="body">
      <div v-if="visible" class="modal-mask">
        <div class="modal-box">
          <button @click="$emit('close')">关闭</button>
        </div>
      </div>
    </teleport>
  </div>
</template>
<script setup>
defineProps(['visible'])
</script>

<style scoped lang="scss">
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
}
.modal-box {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 300px;
  border: 1px solid #ee4;
  background: whitesmoke;
  padding: 20px;
  transform: translate(-50%, -50%);
  border: 10px;
  display: flex;
  justify-content: center;
}
</style>
